Skip to content

Box FloatError::DecimalFloat to shrink the error enum#229

Merged
thedavidmeister merged 2 commits into
mainfrom
2026-05-29-box-floaterror-decimalfloat
May 29, 2026
Merged

Box FloatError::DecimalFloat to shrink the error enum#229
thedavidmeister merged 2 commits into
mainfrom
2026-05-29-box-floaterror-decimalfloat

Conversation

@thedavidmeister
Copy link
Copy Markdown
Contributor

@thedavidmeister thedavidmeister commented May 29, 2026

Summary

  • DecimalFloatErrors is 104 bytes, making FloatError 112 bytes.
  • That trips clippy::result_large_err in downstream consumers (e.g. raindex) whose aggregate error enums embed FloatError — once embedded, their enums exceed the 128-byte threshold.
  • Boxing the DecimalFloat variant drops FloatError to ~64 bytes. Consumers' match/Display are unaffected (deref through Box).

Test plan

  • CI green (autopublish will release the next patch, 0.1.7).

Summary by CodeRabbit

  • Refactor
    • Improved error handling memory management in the float processing system.

Review Change Stack

DecimalFloatErrors is 104 bytes, making FloatError 112 bytes and
tripping clippy::result_large_err in downstream consumers (e.g. raindex)
whose aggregate error enums embed FloatError. Boxing the variant drops
FloatError to ~64 bytes; consumers' match/Display are unaffected.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@thedavidmeister thedavidmeister self-assigned this May 29, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 29, 2026

Warning

Review limit reached

@thedavidmeister, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 19 minutes and 8 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 6ad9826a-3773-427e-8738-3badd921e66a

📥 Commits

Reviewing files that changed from the base of the PR and between 11ebd7d and cb22e26.

📒 Files selected for processing (1)
  • crates/float/src/lib.rs

Walkthrough

The PR boxes the DecimalFloatErrors payload in the FloatError::DecimalFloat enum variant to reduce the enum's memory footprint. The enum definition and a construction site in execute_call_at_address are both updated to reflect this change.

Changes

Box DecimalFloatErrors in FloatError variant

Layer / File(s) Summary
Box DecimalFloatErrors enum variant and construction
crates/float/src/error.rs, crates/float/src/evm.rs
FloatError::DecimalFloat payload type changes from DecimalFloatErrors to Box<DecimalFloatErrors>. The execute_call_at_address function wraps the abi-decoded error in Box::new() when constructing the variant.

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: boxing the FloatError::DecimalFloat variant to reduce the error enum's size.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch 2026-05-29-box-floaterror-decimalfloat

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/float/src/error.rs`:
- Line 24: The pattern matches for FloatError::DecimalFloat must be updated to
account for the Box payload: wherever code currently matches
FloatError::DecimalFloat(DecimalFloatErrors::X(...)) (e.g., the matches! uses in
lib.rs around the noted sites), change the pattern to bind the box
(FloatError::DecimalFloat(inner)) and then match the boxed value in a guard or
inner match (for example use a guard like `if matches!(*inner,
DecimalFloatErrors::Variant(_))` or an inner `match *inner { ... }`) so you
destructure through the Box and correctly detect DecimalFloatErrors variants;
update all occurrences referencing FloatError::DecimalFloat and
DecimalFloatErrors accordingly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 31701bf9-2576-4043-9b3f-75ca07bd2e9b

📥 Commits

Reviewing files that changed from the base of the PR and between 337b64b and 11ebd7d.

📒 Files selected for processing (2)
  • crates/float/src/error.rs
  • crates/float/src/evm.rs

Comment thread crates/float/src/error.rs
Boxing FloatError::DecimalFloat means the inner DecimalFloatErrors is
behind a Box; update the assert!(matches!(...)) sites to match the
variant and deref in a guard.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@thedavidmeister thedavidmeister merged commit c07fdcc into main May 29, 2026
9 checks passed
@github-actions
Copy link
Copy Markdown

@coderabbitai assess this PR size classification for the totality of the PR with the following criterias and report it in your comment:

S/M/L PR Classification Guidelines:

This guide helps classify merged pull requests by effort and complexity rather than just line count. The goal is to assess the difficulty and scope of changes after they have been completed.

Small (S)

Characteristics:

  • Simple bug fixes, typos, or minor refactoring
  • Single-purpose changes affecting 1-2 files
  • Documentation updates
  • Configuration tweaks
  • Changes that require minimal context to review

Review Effort: Would have taken 5-10 minutes

Examples:

  • Fix typo in variable name
  • Update README with new instructions
  • Adjust configuration values
  • Simple one-line bug fixes
  • Import statement cleanup

Medium (M)

Characteristics:

  • Feature additions or enhancements
  • Refactoring that touches multiple files but maintains existing behavior
  • Breaking changes with backward compatibility
  • Changes requiring some domain knowledge to review

Review Effort: Would have taken 15-30 minutes

Examples:

  • Add new feature or component
  • Refactor common utility functions
  • Update dependencies with minor breaking changes
  • Add new component with tests
  • Performance optimizations
  • More complex bug fixes

Large (L)

Characteristics:

  • Major feature implementations
  • Breaking changes or API redesigns
  • Complex refactoring across multiple modules
  • New architectural patterns or significant design changes
  • Changes requiring deep context and multiple review rounds

Review Effort: Would have taken 45+ minutes

Examples:

  • Complete new feature with frontend/backend changes
  • Protocol upgrades or breaking changes
  • Major architectural refactoring
  • Framework or technology upgrades

Additional Factors to Consider

When deciding between sizes, also consider:

  • Test coverage impact: More comprehensive test changes lean toward larger classification
  • Risk level: Changes to critical systems bump up a size category
  • Team familiarity: Novel patterns or technologies increase complexity

Notes:

  • the assessment must be for the totality of the PR, that means comparing the base branch to the last commit of the PR
  • the assessment output must be exactly one of: S, M or L (single-line comment) in format of: SIZE={S/M/L}
  • do not include any additional text, only the size classification
  • your assessment comment must not include tips or additional sections
  • do NOT tag me or anyone else on your comment

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 29, 2026

Tip

For best results, initiate chat on the files or code changes.

SIZE=S

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant